define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'order/index',
        add_url: 'order/add',
        edit_url: 'order/edit',
        delete_url: 'order/delete',
        export_url: 'order/export',
        modify_url: 'order/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: '主键id'},                    {field: 'order_no', title: '订单编号'},                    {field: 'user_id', title: '用户id'},                    {field: 'goods_id', title: '商品id'},                    {field: 'goods_nums', title: '购买数量'},                    {field: 'goods_price', title: '商品单价'},                    {field: 'goods_total', title: '商品总价'},                    {field: 'order_type', title: '订单种类'},                    {field: 'delivery_id', title: '配送方式id'},                    {field: 'address_id', title: '地址id'},                    {field: 'pay_id', title: '支付方式id'},                    {field: 'collage_id', title: '团购id'},                    {field: 'group_master_id', title: '团长id'},                    {field: 'status', title: '订单状态 0-待支付 1-已支付 2-揽件中 3-已发货 4-已完成 5-退款中 6-已退款 7-支付失败 8-待核销  9-已核销', templet: ea.table.switch},                    {field: 'remarks', title: '订单备注'},                    {field: 'create_time', title: '创建时间'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});